package com.info.zhiduoduo.pay.sdk.zhaoshangbank.model.common.query;

import com.info.zhiduoduo.common.utils.DateUtil;
import com.info.zhiduoduo.repository.entity.pay.PaymentMerchant;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class Retreat {

	/** 分行号 */
	private String bbknbr;

	/** 对公账号 */
	private String accnbr;

	/** 代发种类 */
	private String trstyp;

	/** 交易开始日期 */
	private String bgndat;

	/** 交易结束日期 */
	private String enddat;

	public static List<Retreat> ofList(PaymentMerchant paymentMerchant, String orderTime){
		List<Retreat> list = new ArrayList<>();
		Retreat result = new Retreat()
				.setBbknbr(paymentMerchant.getBranchNumber())
				.setAccnbr(paymentMerchant.getBankCard())
				.setTrstyp(paymentMerchant.getTransactionCode())
//				.setBgndat(DateUtil.StrToDate("yyyy-MM-dd HH:mm:ss", orderTime))
				.setBgndat(orderTime)
				.setEnddat(DateUtil.DateToStr("yyyyMMdd",new Date()));
		list.add(result);
		return list;
	}

}
